package indi.pers.priv.onem;
import javax.swing.JFrame;
import javax.swing.JPanel;
import java.awt.*;
import java.awt.geom.GeneralPath;


/**
 * 整个游戏窗口
 */
public class World extends JPanel{
    //窗口的宽高永远不变设计为常量static final
    public static final int WIDTH=400; //窗口的宽
    public static final int HEIGHT=700; //窗口的高
    /**
     * 窗口中的对象
     */
    private Sky sky = new Sky(); //天空对象
    private Hero hero = new Hero(); //英雄机对象
    private FlyingObject[] enemies = {
            new Airplane(),
            new BigAirplane(),
            new Bee()
    }; //敌人(小敌机,大敌机.小蜜蜂)数组
    private Bullet[] bullets = {
            new Bullet(100,200)
    }; //子弹也需要设计数组(子弹是多个的)

    /**重写paint()画  g:画笔*/
    public void paint(Graphics g){

    }

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        World world = new World();
        frame.add(world);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(WIDTH, HEIGHT);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true); //尽快调用pain()方法
    }
}
